<?php
namespace ZfEvent;

class Module
{
    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function onBootrap(EventInterface $e)
    {
        $app = $e->getApplication();
        // get the shared events manager
        $sem = $app->getEventManager()->getSharedManager();
        // listen to 'MyEvent' when triggered by the IndexController
        $sem->attach('ZfEvent\Controller\IndexController', 'MyEvent', function($e) {
            // do something...
        });
    }
}
